package com.yihuan.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;

/**
 * Author:梦醒
 * Date: 2022/1/21 18:45
 * Dream:
 * 信言不美，美言不信。
 * 善者不辩，辩者不善。
 * 知者不博，博者不知。
 * Function:
 */
@RestController
public class JurisdictionController {
    Object UserID;
    Object userCommonID;
    //使用map存储数据
    private Map<String, Object> map = new HashMap<>();
    
    /**
     * 判断是否登录成功
     *
     * @param session
     * @return
     */
    @RequestMapping("/JudgeLogin_4")
    public Map<String, Object> JudgeLogin(HttpSession session) {
        //医院编号
        UserID = session.getAttribute("UserID_4");
        if (UserID != " " && UserID != null) {
            map.put("code", 200);
            map.put("explain ", "=====权限正确=====");
            return map;
        }
        map.put("code", 500);
        map.put("explain ", "=====权限不足=====");
        return map;
    }
    
    /**
     * 判断是否登录成功
     *
     * @param session
     * @return
     */
    @RequestMapping("/JudgeLogin_3")
    public Map<String, Object> JudgeLogin3(HttpSession session) {
        //医院编号
        UserID = session.getAttribute("UserID_3");
        if (UserID != " " && UserID != null) {
            map.put("code", 200);
            map.put("explain ", "=====权限正确=====");
            return map;
        }
        map.put("code", 500);
        map.put("explain ", "=====权限不足=====");
        return map;
    }
    
    /**
     * 判断是否登录成功
     *
     * @param session
     * @return
     */
    @RequestMapping("/JudgeLogin_5")
    public Map<String, Object> SellerID(HttpSession session) {
        //医院编号
        UserID = session.getAttribute("SellerID");
        String SellerNickname = (String) session.getAttribute("SellerNickname");
        if (UserID != " " && UserID != null) {
            map.put("code", 200);
            map.put("sellerNickname", SellerNickname);
            map.put("explain ", "=====权限正确=====");
            return map;
        }
        map.put("code", 500);
        map.put("explain ", "=====权限不足=====");
        return map;
    }
    
    /**
     * 判断是否登录成功
     *
     * @param session
     * @return
     */
    @RequestMapping("/JudgeLogin_6")
    public Map<String, Object> UserNickname(HttpSession session) {
        //医院编号
        UserID = session.getAttribute("UserID");
        String SellerNickname = (String) session.getAttribute("UserNickname");
        if (UserID != " " && UserID != null) {
            map.put("code", 200);
            map.put("sellerNickname", SellerNickname);
            map.put("explain ", "=====权限正确=====");
            return map;
        }
        map.put("code", 500);
        map.put("explain ", "=====权限不足=====");
        return map;
    }
}
